package edu.neusoft.springhtmldemo.service;

import edu.neusoft.springhtmldemo.domain.RobotManagement;
import edu.neusoft.springhtmldemo.mapper.RobotManagementMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RobotManagementService {
    @Autowired
    private RobotManagementMapper mapper;

    public List<RobotManagement> showAll() {
        return mapper.selectAll();
    }

    public List<RobotManagement> selectRobotManagement(RobotManagement management) {
        return mapper.selectRobotManagement(management);
    }

    public void updateRobotManagement(RobotManagement management) {
        mapper.updateRobotManagementbroadcastIP(management);
        mapper.updateRobotManagementcameraIP(management);
        mapper.updateRobotManagementDatastationIP(management);
    }

    public List<String> robotNumValues() {
        return mapper.robotNumValues();
    }

    public void addRobotManagementTables(RobotManagement management) {
        mapper.addRobotBroadcastRelationEntity(management);
        mapper.addRobotDataStationRelationEntity(management);
        mapper.addRobotCameraRelationEntity(management);
    }

    public void delRobotManagementTables(RobotManagement management) {
        mapper.delRobotBroadcastRelationEntity(management);
        mapper.delRobotDataStationRelationEntity(management);
        mapper.delRobotCameraRelationEntity(management);
    }
}
